/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.itcast;

import java.util.Random;

/**
 * <p>Project: JavaStudy - For3
 * <p>Powered by jiangbo On 2023-02-25
 * 11:36:25
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class For3 {
    public static void main(String[] args) {
        Random rand = new Random();
        for (int a=0;a<10;a++){
            for (int b=0;b<10;b++){
                System.out.printf("\033[%dm%02d\033[0m",rand.nextInt(40,48),rand.nextInt(0,20));
            }
            System.out.println();
        }



        for (int a=1;a<=9;a++){
            for (int b=1;b<=a;b++){
                System.out.printf("\033[%dm%dx%d=%-2d\033[0m",rand.nextInt(40,48),a,b,a*b);
                System.out.print(" ");
            }
            System.out.println();
        }
//九九乘法表

        for (int a = 1; a <= 9; a++) {
            for (int b = 1; b <= a; b++) {
                System.out.printf("\033[%dm%2d×%-2d=%-2d\033[0m",rand.nextInt(31,39), a, b, a * b);
            }
            System.out.println();
        }
        System.out.println();
        for (int a = 9; a >= 1; a--) {
            for (int b = a; b >= 1; b--) {
                System.out.printf("\033[%dm%2d×%-2d=%-2d\033[0m",rand.nextInt(31,39), a, b, a * b);
            }
            System.out.println();
        }
    }
}


